#
# Copyright (C) [2024] Xingyun Integrated Circuit, Inc.
#
# GreenCode was a private technology asset of Xingyun Integrated Circuit， Inc （Confidential）
# Author: Shawn.Tan
# Date: 2025.10.28
#
# History: Initial Version 2025.10.28
#
#
from VectorTestSequence import VectorTestSequence
from gpgpu.EnvGPGPU import EnvGPGPU
from gpgpu.GenThreadGPGPU import GenThreadGPGPU


#  This test verifies that whole register load and store instructions can be
#  generated and executed
# successfully.
class MainSequence(VectorTestSequence):
    def __init__(self, aGenThread, aName=None):
        super().__init__(aGenThread, aName)

        self._mInstrList = (
            "VL1RE8.V##CALM",
            "VL1RE16.V##CALM",
            "VL1RE32.V##CALM",
            "VL1RE64.V##CALM",
            "VL2RE8.V##CALM",
            "VL2RE16.V##CALM",
            "VL2RE32.V##CALM",
            "VL2RE64.V##CALM",
            "VL4RE8.V##CALM",
            "VL4RE16.V##CALM",
            "VL4RE32.V##CALM",
            "VL4RE64.V##CALM",
            "VL8RE8.V##CALM",
            "VL8RE16.V##CALM",
            "VL8RE32.V##CALM",
            "VL8RE64.V##CALM",
            "VS1R.V##CALM",
            "VS2R.V##CALM",
            "VS4R.V##CALM",
            "VS8R.V##CALM",
        )

    # Return a list of test instructions to randomly choose from.
    def _getInstructionList(self):
        return self._mInstrList

    # Get allowed exception codes.
    #
    #  @param aInstr The name of the instruction.
    def _getAllowedExceptionCodes(self, aInstr):
        allowed_except_codes = set()

        allowed_except_codes.add(0xF)

        return allowed_except_codes


MainSequenceClass = MainSequence
GenThreadClass = GenThreadGPGPU
EnvClass = EnvGPGPU
